package com.obtk.byproperty.controller;

import com.obtk.byproperty.pojo.ChargeDetail;
import com.obtk.byproperty.service.ChargeDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/chargeDetail")
public class ChargeDetailController {

    @Autowired
    private ChargeDetailService chargeDetailService;

    @RequestMapping("/getChargeId")
    public ChargeDetail getChargeId(Integer chargeItemId){
        ChargeDetail chargeDetail =chargeDetailService.getChargeId(chargeItemId);
        return chargeDetail;
    }
    @RequestMapping("/updateStatus")
    public String updateStatus(ChargeDetail chargeDetail){
       Boolean add= chargeDetailService.update(chargeDetail);
       if(add){
           return "success";
       }
        return "fail";
    }
    @RequestMapping("/selectAnnouncements")
    public List<ChargeDetail> selectAnnouncements(String contractor){
        List<ChargeDetail> chargeDetails= chargeDetailService.selectAnnouncements(contractor);
        return chargeDetails;
    }

}
